<html>
<head><meta charset="utf-8"><title>Visiting Projections · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html">Visiting Projections</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="202116754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202116754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202116754">(Jun 26 2020 at 17:08)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span> <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> about <a href="https://github.com/rust-lang/rust/pull/73732#issuecomment-650289464">https://github.com/rust-lang/rust/pull/73732#issuecomment-650289464</a></p>



<a name="202116805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202116805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202116805">(Jun 26 2020 at 17:09)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span></p>



<a name="202116947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202116947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202116947">(Jun 26 2020 at 17:10)</a>:</h4>
<p>We haven't been able to figure out a good way to make <code>mir::Visitor</code> visit projections. While there were some improvements during the Place refactorings, we kinda stopped there and various visitors still require wild schemes around visiting locals in the correct order and with the correct projection information.</p>



<a name="202116993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202116993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202116993">(Jun 26 2020 at 17:11)</a>:</h4>
<p>the linked PR above tried another approach, which, while improving some cases, made others worse (requiring additional visitor state and such)</p>



<a name="202117046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202117046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202117046">(Jun 26 2020 at 17:11)</a>:</h4>
<p>Quoting from the PR</p>
<blockquote>
<p>I'm starting to wonder if we would be better off with a MIR Visitor 2.0 that was designed specifically for traversing the CFG instead of the current, one-size-fits-all trait.</p>
</blockquote>



<a name="202117158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202117158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202117158">(Jun 26 2020 at 17:12)</a>:</h4>
<p>Maybe we should indeed "just give up" and not have the <code>mir::Visitor</code> go below the <code>visit_place</code> level. We could then offer different schemes for visiting places (maybe as methods on <code>Place</code>?)</p>



<a name="202118490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202118490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202118490">(Jun 26 2020 at 17:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Visiting.20Projections/near/202117158">said</a>:</p>
<blockquote>
<p>Maybe we should indeed "just give up" and not have the <code>mir::Visitor</code> go below the <code>visit_place</code> level. We could then offer different schemes for visiting places (maybe as methods on <code>Place</code>?)</p>
</blockquote>
<p>This is the approach I favor as well. My only new proposal is that <code>Visitor</code> and <code>MutVisitor</code> should diverge here. Creating "fake places" for <code>MutVisitor</code>s is bad, since they have to figure out whether a <code>Place</code> is a fake or not. I want to keep <code>MutVisitor</code> as close to the actual structure MIR as possible and continue to have <code>visit_local</code>, but tweak<code>Visitor</code> to make it more obvious how to write correct analysis passes.</p>



<a name="202119405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202119405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202119405">(Jun 26 2020 at 17:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Visiting.20Projections/near/202116805">said</a>:</p>
<blockquote>
<p>cc <span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span></p>
</blockquote>
<p>checking this is in my todo list, thanks for pinging me <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="202136519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Visiting%20Projections/near/202136519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Visiting.20Projections.html#202136519">(Jun 26 2020 at 20:07)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/73774">#73774</a> is what is required to properly handle locals/places for liveness without some version of <a href="https://github.com/rust-lang/rust/issues/73732">#73732</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>